package com.dadibadi.core.user.controller;


import com.dadibadi.core.dao.entity.UserInfoTab;
import com.dadibadi.core.user.qo.UserInfoEditQO;
import com.dadibadi.core.user.service.UserInfoService;
import com.venusoft.developer.common.result.CommonResult;
import com.venusoft.developer.common.result.ICommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * TODO
 *
 * @author : lkfs@163.com
 * @date : 2025-08-15 18:08
 */

@RestController
@RequestMapping("/user")
@Slf4j
@Tag(name = "api/用户信息", description = "")
public class ApiUserInfoSaveController {

    @Resource
    private UserInfoService userInfoService;

    @PostMapping("/api-user-info-save")
    @Operation(summary = "保存", description = "")
    public ICommonResult exec(
            @RequestBody @Parameter(required = true) @Validated UserInfoEditQO qo,
            @RequestHeader(required = false) String platform,
            @RequestHeader(required = false) String version,
            @RequestHeader(required = false, name = "Accept-Language") String language,
            HttpServletRequest request) {

        UserInfoTab userInfoTab;
        userInfoTab = userInfoService.saveUserInfo(qo);
        return new CommonResult<>(userInfoTab);

    }
}
